<?php
require_once('../config.php');
?>
<div class="close_listicon" onclick="closethis();"><img src="./style/default/close.png" border="0" /></div>
<?php
$regicon = name_fixed_icon;
if(isset($_GET['fol']))
{
		$ff = $_GET['fol'];
		$folderdir = IMAGE_FOLDER_TUONGDOI.'/'.$ff;
		
		$file='';
	if(is_dir ($folderdir))
	{
        $folders = array();
        $dh = opendir($folderdir);
        while ($foldername = readdir($dh)) 
		{
		if( $foldername != ".")
			{
				if($foldername == "..")
				{
					echo'';
				}
				else
				{
					if(is_file($folderdir."/".$foldername))
					$file[] = $foldername;
				}
			}
        }

        closedir($dh);
		if($file!=''){
			sort($file,0);
			$temp=0;
			$count=0;
			echo "<ul class='iconlist'>";
	
			foreach ($file as $filename) 
			 {
				if(strstr($filename,$regicon))
				{
				$filenamefull = str_replace($regicon, "", $filename);
				echo '<li onclick="choosethis(\''.IMAGE_FOLDER.'/'.$ff.'/'.$filename.'\',\''.$filenamefull.'\');">';
				?>
				  <img src="<?php echo IMAGE_FOLDER."/".$ff."/".$filename; ?>"/>
				  </li>
				<?php
				}
			 }
			echo "</ul>";
		}
		else{
			echo "<br />Folder Empty<br />";
		}
	}
	else{
		echo "<br />Folder not exists<br />";
	}
}
else{
	echo "<br />Error variable!<br />";
}
?>
